﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Coffee
{
    public class TypeFactory
    {
        public static void RegisterType(Type type)
        {
            if (RegisteredTypes == null) RegisteredTypes = new List<Type>();
            RegisteredTypes.Add(type);
        }

        protected static List<Type> RegisteredTypes { get; set; }

        public static Type ResolveType(string type)
        {
            return RegisteredTypes.Where(t => t.Name == type).FirstOrDefault();
        }
    }
}
